inherited sprObjectHist: TsprObjectHist
  Left = 284
  Top = 155
  Caption = #1057#1087#1088#1072#1074#1086#1095#1085#1080#1082' '#1078#1091#1088#1085#1072#1083#1080#1088#1091#1077#1084#1099#1093' '#1089#1091#1097#1085#1086#1089#1090#1077#1081
  Constraints.MinHeight = 400
  Constraints.MinWidth = 700
  PixelsPerInch = 96
  TextHeight = 13
  inherited Panel2: TPanel
    Top = 25
    Height = 529
    inherited PageControl1: TPageControl
      Height = 529
      ActivePage = tsForm
      inherited tsTab: TTabSheet
        inherited GroupBox3: TGroupBox
          Height = 501
          inherited dbgRefer: TDBGridEh
            Height = 484
          end
        end
      end
      inherited tsForm: TTabSheet
        inherited GroupBox2: TGroupBox
          Top = 0
          Width = 784
          Height = 501
          Align = alClient
          inherited pnlButtons: TPanel
            Top = 468
            Width = 780
            TabOrder = 2
            inherited SpeedButton1: TSpeedButton
              Left = 581
            end
            inherited SpeedButton2: TSpeedButton
              Left = 683
            end
          end
          object GroupBox4: TGroupBox
            Left = 2
            Top = 53
            Width = 780
            Height = 415
            Align = alClient
            Caption = ' '#1046#1091#1088#1085#1072#1083#1080#1088#1091#1077#1084#1099#1077' '#1089#1074#1086#1081#1089#1090#1074#1072' '
            TabOrder = 1
            object Splitter1: TSplitter
              Left = 339
              Top = 15
              Height = 398
              MinSize = 300
            end
            object dbgAllowFields: TDBGridEh
              Left = 2
              Top = 15
              Width = 337
              Height = 398
              Align = alLeft
              AllowedOperations = []
              DataGrouping.GroupLevels = <>
              DataSource = dscAllowField
              DrawMemoText = True
              Flat = True
              FooterColor = clWindow
              FooterFont.Charset = DEFAULT_CHARSET
              FooterFont.Color = clWindowText
              FooterFont.Height = -11
              FooterFont.Name = 'MS Sans Serif'
              FooterFont.Style = []
              Options = [dgTitles, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit]
              OptionsEh = [dghFixed3D, dghHighlightFocus, dghClearSelection, dghDblClickOptimizeColWidth, dghDialogFind, dghColumnResize, dghExtendVertLines]
              ReadOnly = True
              RowDetailPanel.Color = clBtnFace
              TabOrder = 0
              TitleFont.Charset = DEFAULT_CHARSET
              TitleFont.Color = clWindowText
              TitleFont.Height = -11
              TitleFont.Name = 'MS Sans Serif'
              TitleFont.Style = []
              UseMultiTitle = True
              VTitleMargin = 5
              OnDblClick = dbgAllowFieldsDblClick
              Columns = <
                item
                  EditButtons = <>
                  FieldName = 'FIELD_NAME'
                  Footers = <>
                end
                item
                  EditButtons = <>
                  FieldName = 'DESCRIPTION'
                  Footers = <>
                  Width = 141
                end>
              object RowDetailData: TRowDetailPanelControlEh
              end
            end
            object Panel3: TPanel
              Left = 342
              Top = 15
              Width = 436
              Height = 398
              Align = alClient
              BevelOuter = bvNone
              TabOrder = 1
              object ToolBar2: TToolBar
                Left = 0
                Top = 0
                Width = 23
                Height = 398
                Align = alLeft
                AutoSize = True
                Caption = 'ToolBar2'
                EdgeBorders = []
                Flat = True
                Images = MAIN.ImageList
                TabOrder = 0
                object ToolButton13: TToolButton
                  Left = 0
                  Top = 0
                  Action = aAddField
                  Wrap = True
                end
                object ToolButton12: TToolButton
                  Left = 0
                  Top = 22
                  Action = aDelField
                  Wrap = True
                end
              end
              object dbgLoggedFields: TDBGridEh
                Left = 23
                Top = 0
                Width = 413
                Height = 398
                Align = alClient
                AllowedOperations = []
                DataGrouping.GroupLevels = <>
                DataSource = dscLoggedField
                DrawMemoText = True
                Flat = True
                FooterColor = clWindow
                FooterFont.Charset = DEFAULT_CHARSET
                FooterFont.Color = clWindowText
                FooterFont.Height = -11
                FooterFont.Name = 'MS Sans Serif'
                FooterFont.Style = []
                Options = [dgTitles, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit]
                OptionsEh = [dghFixed3D, dghHighlightFocus, dghClearSelection, dghDblClickOptimizeColWidth, dghDialogFind, dghColumnResize, dghExtendVertLines]
                ReadOnly = True
                RowDetailPanel.Color = clBtnFace
                TabOrder = 1
                TitleFont.Charset = DEFAULT_CHARSET
                TitleFont.Color = clWindowText
                TitleFont.Height = -11
                TitleFont.Name = 'MS Sans Serif'
                TitleFont.Style = []
                UseMultiTitle = True
                VTitleMargin = 5
                OnDblClick = dbgLoggedFieldsDblClick
                Columns = <
                  item
                    EditButtons = <>
                    FieldName = 'FIELD_NAME'
                    Footers = <>
                  end
                  item
                    EditButtons = <>
                    FieldName = 'DESCRIPTION'
                    Footers = <>
                    Width = 220
                  end>
                object RowDetailData: TRowDetailPanelControlEh
                end
              end
            end
          end
          object Panel1: TPanel
            Left = 2
            Top = 15
            Width = 780
            Height = 38
            Align = alTop
            BevelOuter = bvNone
            TabOrder = 0
            object Label1: TLabel
              Left = 20
              Top = 10
              Width = 43
              Height = 13
              Caption = #1058#1072#1073#1083#1080#1094#1072
            end
            object lcbRelation: TDBLookupComboboxEh
              Left = 72
              Top = 8
              Width = 185
              Height = 19
              AlwaysShowBorder = True
              DataField = 'NAME'
              DataSource = dscRefer
              EditButtons = <>
              Flat = True
              KeyField = 'RELATION_NAME'
              ListField = 'RELATION_NAME'
              ListSource = dscRelationList
              TabOrder = 0
              Visible = True
              OnExit = lcbRelationExit
            end
          end
        end
      end
    end
  end
  inherited GroupBox1: TGroupBox
    Height = 0
    Visible = False
  end
  inherited shblActionList: TActionList
    Left = 112
    inherited aDelete: TAction
      Enabled = False
      Visible = False
    end
    object aAddField: TAction
      Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1087#1086#1083#1077' '#1074' '#1089#1087#1080#1089#1086#1082' '#1078#1091#1088#1085#1072#1083#1080#1088#1091#1077#1084#1099#1093
      ImageIndex = 20
      OnExecute = aAddFieldExecute
    end
    object aDelField: TAction
      Hint = #1059#1076#1072#1083#1080#1090#1100' '#1087#1086#1083#1077' '#1080#1079' '#1089#1087#1080#1089#1082#1072' '#1078#1091#1088#1085#1072#1083#1080#1088#1091#1077#1084#1099#1093
      ImageIndex = 21
      OnExecute = aDelFieldExecute
    end
  end
  inherited dsRefer: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE TRELATION_SPR'
      'SET '
      '    NAME = :NAME'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    InsertSQL.Strings = (
      'INSERT INTO TRELATION_SPR('
      '    NAME'
      ')'
      'VALUES('
      '    :NAME'
      ')'
      'returning ID')
    RefreshSQL.Strings = (
      'SELECT'
      '    ID,'
      '    NAME,'
      '    DESCRIPTION'
      'FROM'
      '    TRELATION_SPR '
      ''
      ' WHERE '
      '        TRELATION_SPR.ID = :OLD_ID'
      '    ')
    SelectSQL.Strings = (
      'SELECT'
      '    ID,'
      '    NAME,'
      '    DESCRIPTION'
      'FROM'
      '    TRELATION_SPR ')
    AfterPost = dsReferAfterPost
    UpdateTransaction = trRefer
    object dsReferID: TFIBIntegerField
      DisplayLabel = #1048#1044
      FieldName = 'ID'
      ReadOnly = True
    end
    object dsReferNAME: TFIBStringField
      DisplayLabel = #1053#1072#1079#1074#1072#1085#1080#1077' '#1090#1072#1073#1083#1080#1094#1099
      FieldName = 'NAME'
      Size = 31
      EmptyStrToNull = True
    end
    object dsReferDESCRIPTION: TFIBStringField
      DisplayLabel = #1054#1087#1080#1089#1072#1085#1080#1077
      DisplayWidth = 50
      FieldName = 'DESCRIPTION'
      ReadOnly = True
      Size = 255
      EmptyStrToNull = True
    end
  end
  inherited PropStorage: TPropStorageEh
    Left = 80
  end
  inherited XLSExportDBGridEh: TXLSExportDBGridEh
    Left = 240
    Top = 29
  end
  object dsRelationList: TpFIBDataSet
    SelectSQL.Strings = (
      
        'select trim(r.rdb$relation_name) as relation_name from rdb$relat' +
        'ions r'
      'where r.rdb$system_flag = 0'
      '  and r.rdb$relation_name not containing '#39'$'#39
      '  and r.rdb$relation_name not containing '#39'TMP_'#39
      '  and r.rdb$relation_name not containing '#39'SYS_'#39
      '  and r.rdb$view_source is null'
      '  and exists (select 1 from rdb$relation_fields rf'
      '        where rf.rdb$relation_name = r.rdb$relation_name'
      
        '          and rf.rdb$field_name in ('#39'MODIFYDATE'#39', '#39'MODIFYUSERID'#39 +
        '))'
      '  and (:prelation_name = r.rdb$relation_name'
      '       or'
      '       (cast(:prelation_name as d_tablename) is null'
      '        and'
      
        '        not exists (select 1 from trelation_spr ts where ts.name' +
        ' = r.rdb$relation_name)))'
      'order by 1')
    Transaction = trLists
    Database = MAINDM.pMainDatabase
    Left = 284
    Top = 57
    object dsRelationListRELATION_NAME: TFIBStringField
      FieldName = 'RELATION_NAME'
      Size = 31
      EmptyStrToNull = True
    end
  end
  object dscRelationList: TDataSource
    DataSet = dsRelationList
    Left = 316
    Top = 57
  end
  object dsAllowField: TpFIBDataSet
    RefreshSQL.Strings = (
      
        'select trim(r.rdb$field_name) as field_name, r.rdb$description a' +
        's description, trim(r.rdb$relation_name) as relation_name'
      '  from rdb$relation_fields r'
      '  join trelation_spr ts on ts.name = r.rdb$relation_name'
      '    and r.rdb$system_flag = 0'
      '    and r.rdb$field_name <> '#39'ID'#39
      '    and r.rdb$field_name not containing '#39'CREATEUSER'#39
      '    and r.rdb$field_name not containing '#39'CREATEDATE'#39
      '    and r.rdb$field_name not containing '#39'MODIFYUSER'#39
      '    and r.rdb$field_name not containing '#39'MODIFYDATE'#39
      '    and ts.name = :relation_name    '
      '    and r.rdb$field_name = :OLD_FIELD_NAME '
      
        '  left join trelation_fields tf on tf.field_name = r.rdb$field_n' +
        'ame'
      '    and tf.relation_id = ts.id'
      '  where coalesce(tf.logged, 0) = 0'
      '  ')
    SelectSQL.Strings = (
      
        'select trim(r.rdb$field_name) as field_name, r.rdb$description a' +
        's description, trim(r.rdb$relation_name) as relation_name'
      '  from rdb$relation_fields r'
      '  join trelation_spr ts on ts.name = r.rdb$relation_name'
      '    and r.rdb$system_flag = 0'
      '    and r.rdb$field_name <> '#39'ID'#39
      '    and r.rdb$field_name not containing '#39'CREATEUSER'#39
      '    and r.rdb$field_name not containing '#39'CREATEDATE'#39
      '    and r.rdb$field_name not containing '#39'MODIFYUSER'#39
      '    and r.rdb$field_name not containing '#39'MODIFYDATE'#39
      '    and ts.name = :relation_name     '
      
        '  left join trelation_fields tf on tf.field_name = r.rdb$field_n' +
        'ame'
      '    and tf.relation_id = ts.id'
      '  where coalesce(tf.logged, 0) = 0'
      '  order by 1')
    BeforeOpen = dsAllowFieldBeforeOpen
    Transaction = trRefer
    Database = MAINDM.pMainDatabase
    Left = 148
    Top = 217
    oRefreshAfterPost = False
    object dsAllowFieldRDBFIELD_NAME: TFIBStringField
      DisplayLabel = #1044#1086#1089#1090#1091#1087#1085#1099#1077' '#1087#1086#1083#1103
      FieldName = 'FIELD_NAME'
      Size = 31
      EmptyStrToNull = True
    end
    object dsAllowFieldRDBDESCRIPTION: TFIBMemoField
      DisplayLabel = #1054#1087#1080#1089#1072#1085#1080#1077
      FieldName = 'DESCRIPTION'
      BlobType = ftMemo
      Size = 8
    end
    object dsAllowFieldRDBRELATION_NAME: TFIBStringField
      FieldName = 'RELATION_NAME'
      Size = 31
      EmptyStrToNull = True
    end
  end
  object dscAllowField: TDataSource
    DataSet = dsAllowField
    Left = 180
    Top = 217
  end
  object dsLoggedField: TpFIBDataSet
    DeleteSQL.Strings = (
      'update TRELATION_FIELDS'
      '  set logged = 0'
      '  WHERE ID = :OLD_ID'
      '    ')
    InsertSQL.Strings = (
      'UPDATE OR INSERT INTO TRELATION_FIELDS('
      '    FIELD_NAME,'
      '    RELATION_ID,'
      '    LOGGED'
      ')'
      'VALUES('
      '    :FIELD_NAME,'
      '    :RELATION_ID,'
      '    1'
      ')'
      'matching (FIELD_NAME, RELATION_ID)'
      'returning id')
    RefreshSQL.Strings = (
      'select tr.field_name, tr.description, tr.id, tr.relation_id'
      '  from trelation_fields tr'
      'WHERE TR.ID = :OLD_ID'
      '  and tr.relation_id = :prelation_id'
      '    ')
    SelectSQL.Strings = (
      'select tr.id, tr.field_name, tr.description, '
      '       tr.relation_id'
      '  from trelation_fields tr'
      '  where tr.relation_id = :prelation_id'
      '    and tr.logged = 1'
      '  order by 1')
    BeforeOpen = dsLoggedFieldBeforeOpen
    Transaction = trRefer
    Database = MAINDM.pMainDatabase
    Left = 428
    Top = 209
    oRefreshAfterPost = False
    object dsLoggedFieldFIELD_NAME: TFIBStringField
      DisplayLabel = #1046#1091#1088#1085#1072#1083#1080#1088#1091#1077#1084#1086#1077' '#1087#1086#1083#1077
      FieldName = 'FIELD_NAME'
      Size = 31
      EmptyStrToNull = True
    end
    object dsLoggedFieldDESCRIPTION: TFIBStringField
      DisplayLabel = #1054#1087#1080#1089#1072#1085#1080#1077
      DisplayWidth = 25
      FieldName = 'DESCRIPTION'
      Size = 255
      EmptyStrToNull = True
    end
    object dsLoggedFieldID: TFIBIntegerField
      FieldName = 'ID'
    end
    object dsLoggedFieldRELATION_ID: TFIBIntegerField
      FieldName = 'RELATION_ID'
    end
  end
  object dscLoggedField: TDataSource
    DataSet = dsLoggedField
    Left = 460
    Top = 209
  end
end
